var ws,store_name,avatar,key,store_id='';
var app = angular.module('personal',[]);
app.controller('personalController',function($scope,$http,$filter){
	$scope.initView = function(user_pic,pics){
		$scope.user_pic = user_pic; 
//		console.log(apiRoot + "?act=seller_order&op=order_list");
		$http({
			method:"post",
			url:apiRoot + "?act=seller_order&op=order_list",
			data:{
				key:key,
				record:'record'
			},
			headers:{'Content-Type': 'application/x-www-form-urlencoded'},
	      	transformRequest: function (data) {
                    return $.param(data);
             }
		}).then(function SuccessCallback(data){ 
			console.log(JSON.stringify(data.data.datas.order_list.this_month));
			$scope.this_month = data.data.datas.order_list.this_month;     //本月 
			$scope.last_month = data.data.datas.order_list.last_month; 		//上月	
			$scope.last_months = data.data.datas.order_list.last_months; 	//上上月
			$scope.pics = pics;  
//			$scope.a = $filter('filter')(data.data.datas.order_list,data.data.datas.order_list.order_state,30);
//			console.log(JSON.stringify($scope.a));
						
		},function errorfunction(e){
			error();
		}) 
	}
	$scope.order_details = function (order_sn) {
//		console.log(123);return;
		var nwaiting = plus.nativeUI.showWaiting();//显示原生等待框
		var webviewContent= plus.webview.create('./orders_goods.html','orders_goods.html',{},{order_sn:order_sn,spage:ws.id});//后台创建webview并打开show.html
		webviewContent.addEventListener("loaded", function() { //注册新webview的载入完成事件
	        nwaiting.close(); //新webview的载入完毕后关闭等待框
	        webviewContent.show("slide-in-right",500); //把新webview窗体显示出来，显示动画效果为速度200毫秒的右侧移入动画
	    }, false);
	}
}) 
document.addEventListener('plusready',function(){
	ws = plus.webview.currentWebview();
	key = plus.storage.getItem('key');
	aboutElement = document.querySelector('[ng-controller=personalController]');
	$scope = angular.element(aboutElement).scope();
	$scope.initView(user_pic,pics);
	$scope.$apply();
},false)
